import pandas as pd
from xpinyin import Pinyin

df = pd.read_excel(r'C:\Users\Self-Confidence\Desktop\test.xlsx')
print(df)
df['pinyin'] = df["汉字"].apply(lambda x: Pinyin().get_pinyin(x, '').replace(' ', ''))

df.to_excel(r'C:\Users\Self-Confidence\Desktop\test1.xlsx', index=False)
